home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0004_CARDDETC.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  77 lines

  1. {
  2. EDWIN CALIMBO
  3.  
  4. │Can anyone supply me With a routine to determine a Graphics card? I want
  5. │the Procedure to return a Variable if the user has a Graphics card less
  6. │than an EGA. Anyone have anything quick?
  7.  
  8. The Function below will detect most Graphics (mono/color) card. It's
  9. a bit long, but is has all the info on how to detect certain card.
  10. }
  11.  
  12. Uses
  13.   Dos;
  14.  
  15. Type
  16.   CardType = (none,mda,cga,egamono,egacolor,
  17.               vgamono,vgacolor,mcgamono,mcgacolor);
  18.  
  19. Function VideoCard: CardType;
  20. Var
  21.   code : Byte;
  22.   Regs : Registers;
  23. begin
  24.   Regs.AH := $1A;      (* call VGA Identify Adapter Function *)
  25.   Regs.AL := $00;      (* clear AL to 0...*)
  26.   Intr($10, Regs);     (* call BIOS *)
  27.   If Regs.AL = $1A then
  28.   begin
  29.     Case Regs.BL of
  30.       $00 : VideoCard := NONE;       (* no Graphic card *)
  31.       $01 : VideoCard := MDA;        (* monochrome *)
  32.       $02 : VideoCard := CGA;        (* cga *)
  33.       $04 : VideoCard := EGAColor;   (* ega color *)
  34.       $05 : VideoCard := EGAMono;    (* ega mono*)
  35.       $07 : VideoCard := VGAMono;    (* vga mono *)
  36.       $08 : VideoCard := VGAColor;   (* vga color *)
  37.       $0A,
  38.       $0C : VideoCard := MCGAColor;  (* mcga color *)
  39.       $0B : VideoCard := MCGAMono;   (* mcga mono *)
  40.       Else
  41.         VideoCard := CGA
  42.     end
  43.   end
  44.   Else
  45.   begin
  46.     Regs.AH := $12;         (* use another Function service *)
  47.     Regs.BX := $10;         (* BL = $10 means return EGA info *)
  48.     Intr($10, Regs);        (* call BIOS video Function *)
  49.     If Regs.bx <> $10 Then  (* bx unchanged means EGA is not present *)
  50.     begin
  51.       Regs.AH := $12;
  52.       Regs.BL := $10;
  53.       Intr($10, Regs);
  54.       If Regs.BH = 0 Then
  55.         VideoCard := EGAColor
  56.       Else
  57.         VideoCard := EGAMono
  58.     end
  59.     Else
  60.     begin
  61.       Intr($11, Regs);     (* eguipment determination service *)
  62.       code := (Regs.AL and $30) shr 4;
  63.       If (code = 3) Then
  64.         VideoCard := MDA
  65.       Else
  66.         VideoCard := CGA
  67.     end
  68.   end
  69. end; (* VideoCard *)
  70.  
  71. (*============================= cut here ==================================*)
  72.  
  73. begin
  74.   Case VideoCard of
  75.     VGAColor : Writeln('VGA Color');
  76.   end;
  77. end.